home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / GET_DADS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  848 b   |  29 lines

  1. /*  get_dads.c - convert C pointer to 8088 segmented address  */
  2. /*  this implementation is appropriate for small memory model */
  3. #include   "stdio.h"
  4. #include   "cminor.h"
  5.  
  6. word16    get_ds() ;        /* returns the DS segment value */
  7. word16    get_cs() ;        /* returns the CS segment value */
  8.  
  9. int  get_dads(p,pseg,poff)    /* convert data pointer to seg. addr. */
  10.   char    *p ;            /* pointer value */
  11.   word16   *pseg ;        /* place segment value here */
  12.   word16   *poff ;        /* place offset value here */
  13.   {
  14.      *pseg = get_ds() ;
  15.      *poff = (word16) p ;
  16.   }
  17.  
  18.  
  19. int get_fads(pfun,pseg,poff)    /* convert fun. pointer to seg. adr. */
  20.   int    (*pfun) () ;        /* pointer value */
  21.   word16   *pseg ;        /* place segment value here */
  22.   word16   *poff ;        /* place offset value here */
  23.   {
  24.      *pseg = get_cs() ;
  25.      *poff = (word16) pfun ;
  26.   }
  27.  
  28.  
  29.